home *** CD-ROM | disk | FTP | other *** search
- Path: rcp6.elan.af.mil!rscernix!danpop
- From: danpop@mail.cern.ch (Dan Pop)
- Newsgroups: comp.lang.c
- Subject: Re: Reading a line from a file
- Date: 14 Feb 96 20:35:13 GMT
- Organization: CERN European Lab for Particle Physics
- Message-ID: <danpop.824330113@rscernix>
- References: <4ft5hu$ns6@coranto.ucs.mun.ca>
- NNTP-Posting-Host: ues5.cern.ch
- X-Newsreader: NN version 6.5.0 #7 (NOV)
-
- In <4ft5hu$ns6@coranto.ucs.mun.ca> dpierce@morgan.ucs.mun.ca (David Pierce) writes:
-
- >Anybody out there able to answer this question ?
-
- Yeah, plenty of us. Basically, anybody who has read a C book.
-
- >I have a file with several lines of data in the following format:
- >
- >"123456789","Mr","David","Pierce","Memorial University of NF"
- >...
- >
- >I would like to read in the data between the double quotes. The
- >information between the quotes may or may not have whitespace
- >character's, but the info in quotes is only one field. ie.
- >Memorial University of NF is one field. So here is the million
- >dollar question. Is there a way to use fscanf, or some other C
- >function to read this information without having to read in the
- >complete line and parse out the information I want? I can write
- >a function to do this, but I wondered if there was already a way
- >for C to do this?
-
- The answer is yes and the function is fscanf, of course.
- You can find the details in your C book (you're a programmer consultant,
- aren't you? :-)
-
- >David Pierce
- >Programmer Consultant
- ^^^^^^^^^^^^^^^^^^^^^
- Dan, waiting the promised $1,000,000 :-)
- --
- Dan Pop
- CERN, CN Division
- Email: danpop@mail.cern.ch
- Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
-